package com.fds.system.utils;

import com.fds.system.model.LoginUser;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * @author: fds
 * @date: 2021/8/6
 * @description: 描述
 */
public class CommonUtils {
    public static LoginUser getLoginUser() {
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        if (null == authentication) {
            return null;
        }
        return (LoginUser) authentication.getPrincipal();
    }
}
